<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Categories extends CI_Controller {
			
	public function __construct()
	{
		parent::__construct();
		$this->load->database();
	}
	
	public function _cat_output($output = null)
	{
		$this->load->view('categories',$output);
	}
	
	function index(){
		
		$this->_cat_output((object)array('output' => '' , 'js_files' => array() , 'css_files' => array()));
	}
	
	function get_categories(){
		
		if(!$this->session->userdata('username'))
        {
            $this->load->view('login');
        
		 } else {
		
		$crud = new grocery_CRUD();
		
		$crud->set_theme('flexigrid');
		$crud->set_table('categories');
		$crud->display_as('category','Category Name');
		$crud->set_subject('Categories');

		$crud->required_fields('category');
		
		$crud->field_type('active', 'hidden', 1);
		$crud->columns('category');
		$output = $crud->render();

		$this->_cat_output($output);
		
		}
		
	}
	
}

?>